package com.yjhb.android.sbz.mvp.subject;

import com.yjhb.android.sbz.entity.Subject;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;

import java.util.List;

/**
 * 创建者 zx
 * 创建时间 2021/1/30 15:19
 */
public class SubjectPresenter extends ConventionPresenter<SubjectView> {
    private final String TAG = "SubjectPresenter";

    public SubjectPresenter(SubjectView subjectView) {
        super(subjectView);
    }

    @Override
    protected void onDestroy() {

    }


    public void getSubjects() {
        HttpTool.request(model.getQuestionList(), new HttpObserver<List<Subject>>() {
            @Override
            public void onResult(List<Subject> data) {
                if (view != null) {
                    view.onSuccess(data);
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }

}
